package cn.simple.manager.todo;

import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;

public class ResponseEntity {
   @Getter
   @Setter
   private int status;

    @Getter
    @Setter
    private Object result;

    @Getter
    @Setter
    private String message;

    ResponseEntity(HttpStatus statusCode, Object result, String message){
        this.status=statusCode.value();
        this.result=result;
        this.message=message==null?statusCode.getReasonPhrase():message;
    }
    public static ResponseEntity ok(Object object){
        return new ResponseEntity(HttpStatus.OK,object,null);
    }
    public static ResponseEntity ERRO(String message){
        return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR,null,message);
    }

}
